﻿using System.Collections.Generic;
using System.Windows.Input;

namespace Bookvar.UI.Commands
{
    internal static class CommandGestures
    {
        //TODO: load from resources / user configuration file
        private static readonly Dictionary<string, InputGesture> commandGestures =
            new Dictionary<string, InputGesture>
                {
                    { ApplicationCommands.Undo.Name, new KeyGesture( Key.Z, ModifierKeys.Control ) },
                    { ApplicationCommands.Redo.Name, new KeyGesture( Key.Y, ModifierKeys.Control ) },
                    { BookvarCommands.AddNewTopic.Name, new KeyGesture( Key.Enter ) },
                    { BookvarCommands.AddNewSubtopic.Name, new KeyGesture( Key.Insert ) },
//                    { BookvarCommands.AddNewFloatingTopic.Name, new KeyGesture( ) },
                    { BookvarCommands.DeleteTopic.Name, new KeyGesture( Key.Delete ) },
                    { BookvarCommands.BalanceMap.Name, new KeyGesture( Key.B, ModifierKeys.Alt | ModifierKeys.Control ) },
                    { BookvarCommands.NavigateToHyperlink.Name, new KeyGesture( Key.J, ModifierKeys.Control ) },
                    { BookvarUICommands.FocusSelectedTopic.Name, new KeyGesture( Key.F3 ) },
                };

        internal static InputGesture GetGestureForCommand( ICommand command )
        {
            RoutedCommand routedCommand = command as RoutedCommand;
            if ( routedCommand != null )
            {
                if ( commandGestures.ContainsKey( routedCommand.Name ) )
                {
                    return commandGestures[ routedCommand.Name ];
                }
            }

            return null;
        }
    }
}